package org.springblogs.web;

import org.springblogs.model.SystemUser;
import org.springblogs.service.SystemUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping(value = "/user", path = "/user")
public class SystemUserCtrl {
	@Autowired
	private SystemUserService service;
	@GetMapping(value = "")
	public String init() {
		System.out.println("user init1..");
		SystemUser user = new SystemUser();
		user.setFirstName("ice");
		user.setLastName("liu");
		user = service.save(user );
		System.out.println(user.getId());
		return "user/index";
	}
}
